<script setup>
import { $copyToClipboard } from "@xqsit94/vue3-copy-to-clipboard"
import { ElMessage } from "element-plus"
const props = defineProps({
  copy: String,
  show: String,
})
const visible = ref(false)
const copyText = (message) => {
  try {
    $copyToClipboard(props.copy)
    message && ElMessage.success("复制成功")
  } catch (error) {
    message && ElMessage.error(error || "复制失败")
  }
}
</script>

<template>
  <div class="flex items-center group">
    <slot />
    <i class="dk-iconfont icon-Copy hidden group-hover:block cursor-pointer ml-1" @click="copyText(true)" />
    </div>
</template>
